/*********************************************************
          File Name:9.20.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Mon 14 Sep 2015 08:04:46 PM CST
**********************************************************/

#include <iostream>
#include <deque>
#include <list>

using namespace std;

int main()
{
        list<int> ls{1,2, 3, 4, 5, 6, 7, 8, 9, 10};
        deque<int> odd, even;

        for(auto x: ls)         // shall use `push_xxx` but here use `emplace_xxx`
        {
                if(x % 2 == 0)
                        even.emplace_front(x);
                else
                        odd.emplace_front(x);
        }

        /*
         * for(auto x: ls)
         *      (x & 0x1 ? odd : even).push_back(x);
         */

        for(auto &x: odd)
                cout << "odd " << x << endl;
        cout << "---------------\n";
        for(auto &x: even)
                cout << "even " << x << endl;

        return 0;
}
